<div id="content_worktimes" name="content_worktimes" style="padding-left:0px"><br><h2>Arbeitsplanung</h2><ul>
    <li><a href="/worktime">Arbeitsplanung</a></li>
</ul><hr><br><b><?php print $this->modus;?> - Erstellen</b><br>Bitte benutzen Sie das untere Formular um Einträge zu erstellen.
<?php
	$this->headScript()->appendFile('/libs/jquery-ui-timepicker-addon.js');
	$this->headScript()->appendFile('/libs/js/event/event-form.js');
	$this->headLink()->appendStylesheet('/libs/css/jquery.timepicker.css');
    $this->headScript()->appendFile('/libs/time.js');
    $this->headScript()->appendFile('/libs/date.js');    
?>
<script>
    $(function() {
        dateFrom=Date.parseExact($('#date_from').val(),'dd.MM.yyyy HH:mm');
        dateTo=Date.parseExact($('#date_to').val(),'dd.MM.yyyy HH:mm');
        dateDifference=new TimeSpan(dateTo-dateFrom);
        $('#date_from').change(function(){
            $('#date_to').val(Date.parseExact($('#date_from').val(),'dd.MM.yyyy HH:mm').add({ days: dateDifference.days, hours: dateDifference.hours, minutes: dateDifference.minutes}).toString('dd.MM.yyyy HH:mm'));
        });
        $('#date_to').change(function(){
            dateFrom=Date.parseExact($('#date_from').val(),'dd.MM.yyyy HH:mm');
            dateTo=Date.parseExact($('#date_to').val(),'dd.MM.yyyy HH:mm');
            dateDifference=new TimeSpan(dateTo-dateFrom);
        });    
	    $('#date_from').datetimepicker({
	        showSecond: false,
	        dateFormat: 'dd.mm.yy',
	        timeFormat: 'HH:mm:ss',
	    });
	    $('#date_to').datetimepicker({
	        showSecond: false,
	        dateFormat: 'dd.mm.yy',
	        timeFormat: 'HH:mm:ss',
	    });
	    $('#expire_date').datepicker({
	        dateFormat: 'dd.mm.yy'
	    });
        $('#once_serie').click(function() {
          var value=$('#once_serie').val();
          if(value=='e') {
              $('#expire_date-label').fadeOut('slow', function() {
              });
              $('#expire_date-element').fadeOut('slow', function() {
              });
              $('#x_days-label').fadeOut('slow', function() {
              });
              $('#x_days-element').fadeOut('slow', function() {
              });                        
          } else if(value=='s' || value=='x') {
              $('#expire_date-label').fadeIn('slow', function() {
              });
              $('#expire_date-element').fadeIn('slow', function() {
              });
              if(value=='x') {
                  $('#x_days-label').fadeIn('slow', function() {
                  });
                  $('#x_days-element').fadeIn('slow', function() {
                  });              
              }
              else if(value=='s') {
                  $('#x_days-label').fadeOut('slow', function() {
                  });
                  $('#x_days-element').fadeOut('slow', function() {
                  });              
              }              
          }
        });
        if($('#once_serie-e').is(':checked')) {
            $('#expire_date-label').hide();
            $('#expire_date-element').hide();
        }
        if($('#once_serie').val()=='e' || $('#once_serie').val()=='s') {
            $('#x_days-label').hide();
            $('#x_days-element').hide();
        }
        if($('#once_serie').val()=='e') {        
            $('#expire_date-label').hide();
            $('#expire_date-element').hide();
        }      
        
    });
</script>
<div id="div_errors" name="div_errors"><?php 
    if(0<strlen($this->errors)) 
    print $this->errors; 
?></div>
<?php
    print $this->form;
?>
</div>
